home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / forchek1 / forchek.doc < prev    next >
Text File  |  1991-10-28  |  69KB  |  2,773 lines

  1.  
  2.  
  3.  
  4.                          * * * * * * * * * * * * * *
  5.                          * * *                 * * *
  6.                          * * *  F O R C H E K  * * *
  7.                          * * *    VER. 2.4     * * *
  8.                          * * *  AUGUST, 1991   * * *
  9.                          * * *                 * * *
  10.                          * * * * * * * * * * * * * *
  11.  
  12.  
  13.  
  14.  
  15.                                    CONTENTS
  16.  
  17.  
  18.  
  19.         1       INTRODUCTION . . . . . . . . . . . . . . . . . . . . 1
  20.  
  21.  
  22.         2       INVOKING FORCHEK . . . . . . . . . . . . . . . . . . 2
  23.  
  24.  
  25.         3       FORCHEK OPTIONS  . . . . . . . . . . . . . . . . . . 5
  26.         3.1       Changing The Defaults  . . . . . . . . . . . . .  14
  27.  
  28.  
  29.         4       AN EXAMPLE . . . . . . . . . . . . . . . . . . . .  16
  30.  
  31.  
  32.         5       INTERPRETING THE OUTPUT  . . . . . . . . . . . . .  22
  33.  
  34.  
  35.         6       LIMITATIONS AND EXTENSIONS . . . . . . . . . . . .  30
  36.  
  37.  
  38.         7       NEW FEATURES . . . . . . . . . . . . . . . . . . .  35
  39.  
  40.  
  41.         8       BUGS . . . . . . . . . . . . . . . . . . . . . . .  37
  42.  
  43.  
  44.         9       CONCLUSION . . . . . . . . . . . . . . . . . . . .  40
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. FORCHEK                                                         Page 1
  68.  
  69.  
  70.      1  INTRODUCTION
  71.  
  72.  
  73.  
  74.  
  75.           Forchek (short for  Fortran  checker)  is  designed  to
  76.  
  77.      detect  certain  errors in a Fortran program that a compiler
  78.  
  79.      usually does not.  Forchek  is  not  primarily  intended  to
  80.  
  81.      detect  syntax  errors. Its purpose is to assist the user in
  82.  
  83.      finding semantic errors. Semantic errors are  legal  in  the
  84.  
  85.      Fortran  language  but  are  wasteful or may cause incorrect
  86.  
  87.      operation. For example, variables which are never  used  may
  88.  
  89.      indicate   some   omission  in  the  program;  uninitialized
  90.  
  91.      variables contain garbage which may cause incorrect  results
  92.  
  93.      to  be  calculated; and variables which are not declared may
  94.  
  95.      not have the intended type. Forchek is  intended  to  assist
  96.  
  97.      users  in  the debugging of their Fortran program. It is not
  98.  
  99.      intended to catch all syntax errors. This is the function of
  100.  
  101.      the compiler. Prior to using Forchek, the user should verify
  102.  
  103.      that the program compiles correctly.
  104.  
  105.  
  106.           This document first summarizes how to  invoke  Forchek.
  107.  
  108.      That section should be read before beginning to use Forchek.
  109.  
  110.      Later sections describe Forchek's options  in  more  detail,
  111.  
  112.      give an example of its use, and explain how to interpret the
  113.  
  114.      output. The final sections mention the limitations and known
  115.  
  116.      bugs in Forchek.
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. FORCHEK                                                         Page 2
  134.  
  135.  
  136.      2  INVOKING FORCHEK
  137.  
  138.  
  139.  
  140.  
  141.      Forchek is invoked through a command of the form:
  142.  
  143.  
  144.          $ forchek [-option -option ...] filename [filename ...]
  145.  
  146.  
  147.      (The brackets indicate  something  which  is  optional.  The
  148.  
  149.      brackets  themselves  are  not actually typed.) Here options
  150.  
  151.      are command-line switches or  settings,  which  control  the
  152.  
  153.      operation  of the program and the amount of information that
  154.  
  155.      will be printed out. If no option is specified, the  default
  156.  
  157.      action   is   to   print   error   messages,  warnings,  and
  158.  
  159.      informational messages,  but  not  the  program  listing  or
  160.  
  161.      symbol tables.
  162.  
  163.  
  164.           Each option begins with the '-' character. (On  VAX/VMS
  165.  
  166.      systems  you  may  use  either  '/' or '-'.) The options are
  167.  
  168.      described at greater length in the next section.
  169.  
  170.  
  171.           Forchek options fall  into  two  categories:  switches,
  172.  
  173.      which  are  either true or false, and settings, which have a
  174.  
  175.      numeric or string  value.  The  name  of  a  switch  can  be
  176.  
  177.      preceded  by  'no'  to turn it off: e.g. -nousage would turn
  178.  
  179.      off the warnings about variable  usage.  Only  the  first  3
  180.  
  181.      characters  of an option name (not counting the '-') need be
  182.  
  183.      provided. The switches which  Forchek  currently  recognizes
  184.  
  185.      are:
  186.  
  187.  
  188.           -declare       Print a list of  all  identifiers  whose
  189.                          datatype  is  not  explicitly  declared.
  190.                          Default = no.
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. FORCHEK                                                         Page 3
  200.  
  201.  
  202.           -division      Warn wherever division is  done  (except
  203.                          division by a constant). Default = no.
  204.  
  205.           -extern        Warn if external subprograms  which  are
  206.                          invoked  are  never  defined.  Default =
  207.                          yes.
  208.  
  209.           -f77           Warn about violations of the Fortran  77
  210.                          standard. Default = no.
  211.  
  212.           -library       Begin  library  mode:  do  not  warn  if
  213.                          subprograms  in  file  are  defined  but
  214.                          never used. Default = no.
  215.  
  216.           -linebreak     Treat linebreaks in continued statements
  217.                          as space. Default = yes.
  218.  
  219.           -list          Print source listing of program. Default
  220.                          = no.
  221.  
  222.           -portability   Warn about non-portable usages.  Default
  223.                          = no.
  224.  
  225.           -project       Create  project  file  (see  explanation
  226.                          below). Default = no.
  227.  
  228.           -sixchar       List any variable names which clash at 6
  229.                          characters length. Default = no.
  230.  
  231.           -symtab        Print out symbol table. Default = no.
  232.  
  233.           -usage         Warn if variables not used, etc. Default
  234.                          = yes.
  235.  
  236.           -verbose       Produce full amount of output. Default =
  237.                          yes.
  238.  
  239.      There are four settings:
  240.  
  241.           -columns=n     Set maximum line length  to  n  columns.
  242.                          (Beyond  this  is  ignored.) Max is 132.
  243.                          Default = 72.
  244.  
  245.           -common=n      Level of strictness in  checking  common
  246.                          blocks. Min is 0 (no checking). Max is 3
  247.                          (must be identical). Default = 3.
  248.  
  249.           -novice=n      Set novice level, which controls certain
  250.                          types  of warnings. Min is 1 (tyro). Max
  251.                          is 5 (wizard). Default = 1.
  252.  
  253.           -output=filename Send output to the given file. Default
  254.                          is   to   send  output  to  the  screen.
  255.                          (Default filename extension is .lis).
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. FORCHEK                                                         Page 4
  266.  
  267.  
  268.           When more than one  option  is  used,  they  should  be
  269.  
  270.      separated  by  a  blank space. No blank spaces may be placed
  271.  
  272.      around the equals (=) in a setting. Forchek "?" will produce
  273.  
  274.      a list of all options and settings.
  275.  
  276.  
  277.           When giving a name of an input file, the  extension  is
  278.  
  279.      optional.  If no extension is given, Forchek will first look
  280.  
  281.      for a project file with extension '.prj' and will  use  that
  282.  
  283.      if  it  exists. If not, then Forchek will look for a Fortran
  284.  
  285.      source file with the extension '.for' for VMS systems,  '.f'
  286.  
  287.      for  Unix  systems.  More than one file name can be given to
  288.  
  289.      Forchek, and it will process the modules in all files as  if
  290.  
  291.      they were in a single file.
  292.  
  293.  
  294.           If no filename is given, Forchek will read  input  from
  295.  
  296.      the standard input.
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331. FORCHEK                                                         Page 5
  332.  
  333.  
  334.      3  FORCHEK OPTIONS
  335.  
  336.  
  337.  
  338.  
  339.           This section provides a  more  detailed  discussion  of
  340.  
  341.      Forchek  command-line  options. Options and filenames may be
  342.  
  343.      interspersed on a  command  line.  Each  option  remains  in
  344.  
  345.      effect  from  the  point  it  is  encountered  until  it  is
  346.  
  347.      overridden by a later option. Thus for example, the  listing
  348.  
  349.      may be suppressed for some files and not for others.
  350.  
  351.  
  352.           The  option  names  in  the  following  list   are   in
  353.  
  354.      alphabetical order.
  355.  
  356.  
  357.                               -columns=n
  358.  
  359.  
  360.           Set maximum line length to n columns. (Beyond  this  is
  361.  
  362.      ignored.)  This  setting  is  provided  to allow checking of
  363.  
  364.      programs which may violate the Fortran standard limit of  72
  365.  
  366.      columns for the length of a line. According to the standard,
  367.  
  368.      all characters past column 72 are ignored. This setting does
  369.  
  370.      not  affect the reporting of overlength lines under the -f77
  371.  
  372.      option. Max is 132. Default = 72.
  373.  
  374.  
  375.                               -common=n
  376.  
  377.  
  378.           This setting  varies  the  strictness  of  checking  of
  379.  
  380.      common blocks. Level 3 is the strictest: it requires that in
  381.  
  382.      each declaration of  a  given  common  block,  corresponding
  383.  
  384.      variables agree in data type and (if arrays) size and number
  385.  
  386.      of  dimensions.  Levels  1   and   2   require   only   that
  387.  
  388.      corresponding  memory  locations  agree  in  data  type. The
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397. FORCHEK                                                         Page 6
  398.  
  399.  
  400.      difference between Levels 1 and 2 is that Level 2  warns  if
  401.  
  402.      the blocks are not equal in total length, while Level 1 does
  403.  
  404.      not. Level 0 suppresses all checking. Default = 3.
  405.  
  406.  
  407.                                -declare
  408.  
  409.  
  410.           If this flag is set, all identifiers whose datatype  is
  411.  
  412.      not  declared  in  each  module will be listed. This flag is
  413.  
  414.      useful for helping to find misspelled variable  names,  etc.
  415.  
  416.      The  same  listing  will  be given if the module contains an
  417.  
  418.      IMPLICIT NONE statement. Default = no.
  419.  
  420.  
  421.                               -division
  422.  
  423.  
  424.           This switch is provided to help  users  spot  potential
  425.  
  426.      division by zero problems. If this switch is selected, every
  427.  
  428.      division except by  a  constant  will  be  flagged.  (It  is
  429.  
  430.      assumed that the user is intelligent enough not to divide by
  431.  
  432.      a constant which is equal to zero!) Default = no.
  433.  
  434.  
  435.                                -extern
  436.  
  437.  
  438.           Causes  Forchek  to  report  whether  any   subprograms
  439.  
  440.      invoked  by  the  program are never defined, or are multiply
  441.  
  442.      defined. Ordinarily, if Forchek is being run on  a  complete
  443.  
  444.      program,  each subprogram other than the intrinsic functions
  445.  
  446.      should be defined once and only  once  somewhere.  Turn  off
  447.  
  448.      this  switch  if  you  just  want to check a subset of files
  449.  
  450.      which form part of a larger complete program,  or  to  check
  451.  
  452.      all  at  once  a  number of unrelated files which might each
  453.  
  454.      contain an unnamed main program. Subprogram  arguments  will
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463. FORCHEK                                                         Page 7
  464.  
  465.  
  466.      still be checked for correctness. Default = yes.
  467.  
  468.  
  469.                                  -f77
  470.  
  471.  
  472.           Use  this  flag  to  catch  language  extensions  which
  473.  
  474.      violate  the  Fortran 77 standard. Such extensions may cause
  475.  
  476.      your program not to be portable. Examples include the use of
  477.  
  478.      underscores  in  variable  names; variable names longer than
  479.  
  480.      six characters; statement lines longer than  72  characters;
  481.  
  482.      and   nonstandard  statements  such  as  the  DO  ...  ENDDO
  483.  
  484.      structure. Forchek does not report on the use  of  lowercase
  485.  
  486.      letters. Default=no.
  487.  
  488.  
  489.                                -library
  490.  
  491.  
  492.           This switch is used when a number  of  subprograms  are
  493.  
  494.      contained  in  a  file,  but not all of them are used by the
  495.  
  496.      application. Normally, Forchek warns you if any  subprograms
  497.  
  498.      are  defined but never used. This switch will suppress these
  499.  
  500.      warnings. Default = no.
  501.  
  502.  
  503.                               -linebreak
  504.  
  505.  
  506.           Normally, when scanning a statement which is  continued
  507.  
  508.      onto  the next line, Forchek treats the end of the line as a
  509.  
  510.      space. This behavior is the same as for Pascal  and  C,  and
  511.  
  512.      also corresponds to how humans normally would read and write
  513.  
  514.      programs.  However,  occasionally  one  would  like  to  use
  515.  
  516.      Forchek to check a program in which identifiers and keywords
  517.  
  518.      are split across lines,  for  instance  programs  which  are
  519.  
  520.      produced   using   a   preprocessor.   Choosing  the  option
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529. FORCHEK                                                         Page 8
  530.  
  531.  
  532.      -nolinebreak will cause Forchek to skip over the end of line
  533.  
  534.      and  also  any  leading space on the continuation line (from
  535.  
  536.      the continuation mark up to the first  nonspace  character).
  537.  
  538.      Default = yes, i.e. treat linebreaks as space.
  539.  
  540.  
  541.           Note that in nolinebreak mode, if token pairs requiring
  542.  
  543.      intervening  space  (for  instance,  GOTO 100) are separated
  544.  
  545.      only by a linebreak, they will be rejoined.
  546.  
  547.  
  548.           Also, tokens  requiring  more  than  one  character  of
  549.  
  550.      lookahead  for  the  resolution  of  ambiguities must not be
  551.  
  552.      split across lines. In particular, a  complex  constant  may
  553.  
  554.      not be split across a line.
  555.  
  556.  
  557.                                 -list
  558.  
  559.  
  560.           Specifies that a listing of the Fortran program  is  to
  561.  
  562.      be  printed  out  with  line  numbers. If Forchek detects an
  563.  
  564.      error, the error message follows the  program  line  with  a
  565.  
  566.      caret (^) specifying the location of the error. If no source
  567.  
  568.      listing was requested, Forchek will still print out any line
  569.  
  570.      containing  an  error,  to aid the user in determining where
  571.  
  572.      the error occurred. Default = no.
  573.  
  574.  
  575.                               -novice=n
  576.  
  577.  
  578.           This setting controls certain messages about conditions
  579.  
  580.      which  are  likely  to be errors for novice programmers, but
  581.  
  582.      which  are   often   intentional   by   more   sophisticated
  583.  
  584.      programmers. Some of these warnings deal with cases in which
  585.  
  586.      Forchek suspects that what  appears  to  be  a  function  is
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595. FORCHEK                                                         Page 9
  596.  
  597.  
  598.      intended to be an array, which the user forgot to declare in
  599.  
  600.      a DIMENSION statement. Since a function  invocation  and  an
  601.  
  602.      array  reference  are identical in syntax, undeclared arrays
  603.  
  604.      are interpreted by the Fortran compiler and  by  Forchek  as
  605.  
  606.      functions.  Novice  users are often confused by the messages
  607.  
  608.      which result. Forchek attempts  to  remedy  this  confusion.
  609.  
  610.      Default level = 1.
  611.  
  612.  
  613.           The  novice  levels  are  given  below.   The   warning
  614.  
  615.      corresponding  to  each  number  will  be  suppressed if the
  616.  
  617.      novice level is set to greater than that value.
  618.  
  619.          1. Warn if arrays passed as arguments to a subprogram do
  620.             not  match  the corresponding dummy arguments in both
  621.             number of dimensions  and  size.  Exception:  if  the
  622.             declared  size  of  the  dummy array is 1 or if it is
  623.             dimensioned with a dummy variable, only the number of
  624.             dimensions will be checked.
  625.  
  626.          2. Warn the user if any argument of a subprogram appears
  627.             to  be  a function. This warning is suppressed if the
  628.             dummy argument is declared in an EXTERNAL  statement.
  629.             Novice programmers seldom pass functions as arguments
  630.             of a subprogram, so it is more likely  that  such  an
  631.             argument  was  intended  to  be an array, but was not
  632.             dimensioned.
  633.  
  634.          3. If a function was invoked but never  defined,  advise
  635.             the  user  that  it  may  be  an  array which was not
  636.             dimensioned.  This  warning  is  suppressed  if   the
  637.             function  is  declared  in  an  EXTERNAL or INTRINSIC
  638.             statement in any module of the program. This  warning
  639.             is completely suppressed by the -noextern option.
  640.  
  641.          4. Warn if a function  has  side  effects:  i.e.  if  it
  642.             modifies any of its arguments, or modifies a variable
  643.             in common. Ideally, a function has no  side  effects,
  644.             and  acts  only  by  computing  a  value based on its
  645.             arguments, whereas a subroutine normally acts through
  646.             side  effects. Advanced programmers sometimes wish to
  647.             combine the features of a subroutine and  a  function
  648.             in a single module.
  649.  
  650.  
  651.                            -output=filename
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661. FORCHEK                                                        Page 10
  662.  
  663.  
  664.           This setting is provided  for  convenience  on  systems
  665.  
  666.      which do not allow easy redirection of output from programs.
  667.  
  668.      When this  setting  is  given,  the  output  which  normally
  669.  
  670.      appears  on  the  screen  will  be sent instead to the named
  671.  
  672.      file. Note, however,  that  operational  errors  of  Forchek
  673.  
  674.      itself (e.g. out of space or cannot open file) will still be
  675.  
  676.      sent to the  screen.  The  extension  for  the  filename  is
  677.  
  678.      optional,  and  if no extension is given, the extension .lis
  679.  
  680.      will be used.
  681.  
  682.  
  683.                              -portability
  684.  
  685.  
  686.           Forchek  will  give   warnings   for   a   variety   of
  687.  
  688.      non-portable usages. These include the use of tabs except in
  689.  
  690.      comments or inside strings, the use of hollerith  constants,
  691.  
  692.      and  the equivalencing of variables of different data types.
  693.  
  694.      This option does not produce warnings for violations of  the
  695.  
  696.      Fortran  77  standard,  which  may  also  cause  portability
  697.  
  698.      problems. To catch those, use the -f77 option. Default = no.
  699.  
  700.  
  701.                                -project
  702.  
  703.  
  704.           Forchek will create a project  file  from  each  source
  705.  
  706.      file that is input while this flag is in effect. The project
  707.  
  708.      file will be given the same name as the input file, but with
  709.  
  710.      the  extension  '.f' or '.for' replaced by '.prj'. (If input
  711.  
  712.      is  from  standard  input,  the  project   file   is   named
  713.  
  714.      forchek.prj.) Default = no.
  715.  
  716.  
  717.      A project file contains a summary of  information  from  the
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727. FORCHEK                                                        Page 11
  728.  
  729.  
  730.      source  file,  for use in checking agreement among function,
  731.  
  732.      subroutine, and common  block  usages  in  other  files.  It
  733.  
  734.      allows  incremental  checking, which saves time whenever you
  735.  
  736.      have a large set of  files  containing  shared  subroutines,
  737.  
  738.      most  of  which  seldom  change. You can run Forchek once on
  739.  
  740.      each file with the -project flag set, creating  the  project
  741.  
  742.      files. Usually you would also set the -library and -noextern
  743.  
  744.      flags  at  this  time,  to  suppress  messages  relating  to
  745.  
  746.      consistency with other files. Only error messages pertaining
  747.  
  748.      to each file  by  itself  will  be  printed  at  this  time.
  749.  
  750.      Thereafter,  run  Forchek  without  these  flags  on all the
  751.  
  752.      project files  together,  to  check  consistency  among  the
  753.  
  754.      different  files.  All  messages  internal to the individual
  755.  
  756.      files will now be omitted. Only when a file is altered  will
  757.  
  758.      a new project file need to be made for it.
  759.  
  760.  
  761.           The information saved in the project file  consists  of
  762.  
  763.      all  subprogram declarations, all subprogram invocations not
  764.  
  765.      resolved by declarations in the same file, and one  instance
  766.  
  767.      of each common block declaration. Thus project files contain
  768.  
  769.      only information for checking agreement between files.  This
  770.  
  771.      means that a project file is of no use if all modules of the
  772.  
  773.      complete program are contained in a single file.
  774.  
  775.  
  776.           Naturally, when the -project flag is set, Forchek  will
  777.  
  778.      not read project files as input.
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793. FORCHEK                                                        Page 12
  794.  
  795.  
  796.           Here is an example  of  how  to  use  the  Unix  "make"
  797.  
  798.      utility to automatically create a new project file each time
  799.  
  800.      the corresponding source file is altered, and to  check  the
  801.  
  802.      set  of  files  for  consistency. The example assumes that a
  803.  
  804.      macro OBJS has been defined which lists  all  the  names  of
  805.  
  806.      object  files  to  be  linked  together to form the complete
  807.  
  808.      executable program.
  809.  
  810.          # tell make what a project file suffix is
  811.          .SUFFIXES: .prj
  812.  
  813.          # tell make how to create a .prj file from a .f file
  814.          .f.prj:
  815.                  forchek -project -noextern -library $<
  816.  
  817.          # set up macro PRJS containing project filenames
  818.          PRJS= $(OBJS:.o=.prj)
  819.  
  820.          # "make check" will check everything that has been changed.
  821.          check: $(PRJS)
  822.                  forchek $(PRJS)
  823.  
  824.  
  825.                                -sixchar
  826.  
  827.  
  828.           One of the goals of the  Forchek  program  is  to  help
  829.  
  830.      users  to  write  portable  Fortran  programs. One potential
  831.  
  832.      source of nonportability is the use of variable  names  that
  833.  
  834.      are  longer  than six characters. Some compilers just ignore
  835.  
  836.      the extra characters. This behavior could  potentially  lead
  837.  
  838.      to two different variables being considered as the same. For
  839.  
  840.      instance, variables named AVERAGECOST and  AVERAGEPRICE  are
  841.  
  842.      the  same  in the first six characters. If you wish to catch
  843.  
  844.      such possible conflicts, use this flag. Default = no.
  845.  
  846.  
  847.                                -symtab
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859. FORCHEK                                                        Page 13
  860.  
  861.  
  862.           A symbol table will be printed  out  for  each  module,
  863.  
  864.      listing  all identifiers mentioned in the module. This table
  865.  
  866.      gives the name of  each  variable,  its  datatype,  and  the
  867.  
  868.      number  of  dimensions for arrays. An asterisk (*) indicates
  869.  
  870.      that the variable has been  implicitly  typed,  rather  than
  871.  
  872.      being  named  in an explicit type declaration statement. The
  873.  
  874.      table also lists all subprograms invoked by the module,  all
  875.  
  876.      common blocks declared, etc. Default = no.
  877.  
  878.  
  879.                                 -usage
  880.  
  881.  
  882.           This switch is on by default. It causes Forchek to list
  883.  
  884.      all variables which may be used before they are initialized,
  885.  
  886.      or which are given a value but never subsequently  used,  or
  887.  
  888.      which are declared but never used. Sometimes Forchek makes a
  889.  
  890.      mistake about this. Usually it errs on the side of giving  a
  891.  
  892.      warning  where  no problem exists, but in rare cases it will
  893.  
  894.      fail to warn where the problem does exist. See  the  section
  895.  
  896.      on  bugs  for  examples.  If variables are equivalenced, the
  897.  
  898.      rule used by Forchek is that a  reference  to  any  variable
  899.  
  900.      implies   the   same   reference  to  all  variables  it  is
  901.  
  902.      equivalenced to. Default = yes.
  903.  
  904.  
  905.                                -verbose
  906.  
  907.  
  908.           This option is on by default. Turning  it  off  reduces
  909.  
  910.      the  amount  of output relating to normal operation, so that
  911.  
  912.      error messages are more apparent. This  option  is  provided
  913.  
  914.      for  the  convenience of users who are checking large suites
  915.  
  916.      of files.  The  eliminated  output  includes  the  names  of
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925. FORCHEK                                                        Page 14
  926.  
  927.  
  928.      project  files,  and  the  message  reporting that no syntax
  929.  
  930.      errors were found. (Some of this output is turned back on by
  931.  
  932.      the -list and -symtab options.) Default = yes.
  933.  
  934.  
  935.  
  936.      3.1  Changing The Defaults
  937.  
  938.  
  939.           Forchek includes a mechanism for changing  the  default
  940.  
  941.      values  of  all  options  by defining environment variables.
  942.  
  943.      When Forchek starts up, it looks in its environment for  any
  944.  
  945.      variables  whose  names are composed by prefixing the string
  946.  
  947.      "FORCHEK_" onto the uppercased version of  the  option  name
  948.  
  949.      (the  quote  marks  are  not  part  of  the name.) If such a
  950.  
  951.      variable is found, its value is used to specify the  default
  952.  
  953.      for  the  corresponding  switch  or  setting. In the case of
  954.  
  955.      settings (for example, the novice level) the  value  of  the
  956.  
  957.      environment  variable  is read as the default setting value.
  958.  
  959.      In the case of switches, the default switch will be taken as
  960.  
  961.      true  or "YES" unless the environment variable has the value
  962.  
  963.      "0" or "NO" (again, the quotes are not part of  the  value).
  964.  
  965.      Of course, command-line options will override these defaults
  966.  
  967.      the same way as they override the built-in defaults.
  968.  
  969.  
  970.           Note  that  the  environment  variable  name  must   be
  971.  
  972.      constructed  with the full-length option name, which must be
  973.  
  974.      in uppercase. For example, to make Forchek  print  a  source
  975.  
  976.      listing   by   default,   set   the   environment   variable
  977.  
  978.      "FORCHEK_LIST" to "1" or "YES" or anything other than "0" or
  979.  
  980.      "NO".  The names "FORCHEK_LIS" (not the full option name) or
  981.  
  982.      "forchek_list" (lower case) would not be recognized.
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991. FORCHEK                                                        Page 15
  992.  
  993.  
  994.           Here are  some  examples  of  how  to  set  environment
  995.  
  996.      variables  on  various  systems.  For  simplicity,  all  the
  997.  
  998.      examples set the default -list switch to "yes."
  999.  
  1000.      1.  Unix, Bourne shell:  $ FORCHEK_LIST=YES
  1001.                               $ export FORCHEK_LIST
  1002.  
  1003.      2.  Unix, C shell:       % setenv FORCHEK_LIST YES
  1004.  
  1005.      3.  VAX/VMS:             $ DEFINE FORCHEK_LIST YES
  1006.  
  1007.      4.  MSDOS:               $ SET FORCHEK_LIST=YES
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057. FORCHEK                                                        Page 16
  1058.  
  1059.  
  1060.      4  AN EXAMPLE
  1061.  
  1062.  
  1063.  
  1064.  
  1065.           The following simple Fortran  program  illustrates  the
  1066.  
  1067.      messages given by Forchek. The program is intended to accept
  1068.  
  1069.      an array of test scores and then compute the average for the
  1070.  
  1071.      series.
  1072.  
  1073.  
  1074.      C       AUTHORS: MIKE MYERS AND LUCIA SPAGNUOLO
  1075.      C       DATE:    MAY 8, 1989
  1076.      C       Variables:
  1077.      C               SCORE -> an array of test scores
  1078.      C               SUM ->   sum of the test scores
  1079.      C               COUNT -> counter of scores read in
  1080.      C               I ->     loop counter
  1081.              REAL FUNCTION COMPAV(SCORE,COUNT)
  1082.                  INTEGER SUM,COUNT,J,SCORE(5)
  1083.                  DO 30 I = 1,COUNT
  1084.                      SUM = SUM + SCORE(I)
  1085.      30          CONTINUE
  1086.                  COMPAV = SUM/COUNT
  1087.              END
  1088.              PROGRAM AVENUM
  1089.      C
  1090.      C                       MAIN PROGRAM
  1091.      C
  1092.      C       AUTHOR:   LOIS BIGBIE
  1093.      C       DATE:     MAY 15, 1990
  1094.      C
  1095.      C       Variables:
  1096.      C               MAXNOS -> maximum number of input values
  1097.      C               NUMS    -> an array of numbers
  1098.      C               COUNT   -> exact number of input values
  1099.      C               AVG     -> average returned by COMPAV
  1100.      C               I       -> loop counter
  1101.      C
  1102.                  PARAMETER(MAXNOS=5)
  1103.                  INTEGER I, COUNT
  1104.                  REAL NUMS(MAXNOS), AVG
  1105.                  COUNT = 0
  1106.                  DO 80 I = 1,MAXNOS
  1107.                      READ (5,*,END=100) NUMS(I)
  1108.                      COUNT = COUNT + 1
  1109.      80          CONTINUE
  1110.      100         AVG = COMPAV(NUMS, COUNT)
  1111.              END
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123. FORCHEK                                                        Page 17
  1124.  
  1125.  
  1126.           The compiler gives no error messages when this  program
  1127.  
  1128.      is compiled. Yet here is what happens when it is run:
  1129.  
  1130.      $ run average
  1131.      70
  1132.      90
  1133.      85
  1134.      <EOF>
  1135.      $
  1136.  
  1137.  
  1138.      What happened? Why  didn't  the  program  do  anything?  The
  1139.  
  1140.      following  is  the  output  from  Forchek when it is used to
  1141.  
  1142.      debug the above program:
  1143.  
  1144.  
  1145.  
  1146. $ forchek -list -symtab average
  1147.  
  1148. FORCHEK Version 2.4 August 1991
  1149.  
  1150. File average.f:
  1151.  
  1152.       1 C       AUTHORS: MIKE MYERS AND LUCIA SPAGNUOLO
  1153.       2 C       DATE:    MAY 8, 1989
  1154.       3
  1155.       4 C       Variables:
  1156.       5 C               SCORE -> an array of test scores
  1157.       6 C               SUM ->   sum of the test scores
  1158.       7 C               COUNT -> counter of scores read in
  1159.       8 C               I ->     loop counter
  1160.       9
  1161.      10         REAL FUNCTION COMPAV(SCORE,COUNT)
  1162.      11             INTEGER SUM,COUNT,J,SCORE(5)
  1163.      12
  1164.      13             DO 30 I = 1,COUNT
  1165.      14                 SUM = SUM + SCORE(I)
  1166.      15 30          CONTINUE
  1167.      16             COMPAV = SUM/COUNT
  1168.                            ^
  1169. Warning near line 16 col 20: integer quotient expr converted to real
  1170.      17         END
  1171.      18
  1172.  
  1173. Module COMPAV: func: real
  1174.  
  1175. Variables:
  1176.  
  1177.       Name Type Dims     Name Type Dims     Name Type Dims     Name Type Dims
  1178.     COMPAV real         COUNT intg             I intg*            J intg
  1179.      SCORE intg  1        SUM intg
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189. FORCHEK                                                        Page 18
  1190.  
  1191.  
  1192. * Variable not declared. Type has been implicitly defined.
  1193.  
  1194.  
  1195. Variables declared but never referenced in module COMPAV:
  1196.          J
  1197.  
  1198. Variables may be used before set in module COMPAV:
  1199.        SUM
  1200.  
  1201.  
  1202.      19
  1203.      20         PROGRAM AVENUM
  1204.      21 C
  1205.      22 C                       MAIN PROGRAM
  1206.      23 C
  1207.      24 C       AUTHOR:   LOIS BIGBIE
  1208.      25 C       DATE:     MAY 15, 1990
  1209.      26 C
  1210.      27 C       Variables:
  1211.      28 C               MAXNOS -> maximum number of input values
  1212.      29 C               NUMS    -> an array of numbers
  1213.      30 C               COUNT   -> exact number of input values
  1214.      31 C               AVG     -> average returned by COMPAV
  1215.      32 C               I       -> loop counter
  1216.      33 C
  1217.      34
  1218.      35             PARAMETER(MAXNOS=5)
  1219.      36             INTEGER I, COUNT
  1220.      37             REAL NUMS(MAXNOS), AVG
  1221.      38             COUNT = 0
  1222.      39             DO 80 I = 1,MAXNOS
  1223.      40                 READ (5,*,END=100) NUMS(I)
  1224.      41                 COUNT = COUNT + 1
  1225.      42 80          CONTINUE
  1226.      43 100         AVG = COMPAV(NUMS, COUNT)
  1227.      44         END
  1228.  
  1229. Module AVENUM: prog
  1230.  
  1231. External subprograms referenced:
  1232.  
  1233.     COMPAV: real*
  1234.  
  1235. Variables:
  1236.  
  1237.       Name Type Dims     Name Type Dims     Name Type Dims     Name Type Dims
  1238.        AVG real         COUNT intg             I intg        MAXNOS intg*
  1239.       NUMS real  1
  1240.  
  1241. * Variable not declared. Type has been implicitly defined.
  1242.  
  1243.  
  1244. Variables set but never used in module AVENUM:
  1245.        AVG
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255. FORCHEK                                                        Page 19
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  0 syntax errors detected in file average.f
  1261.  1 warning issued in file average.f
  1262.  
  1263. Subprogram COMPAV:  argument data type mismatch
  1264.   at position 1:
  1265.         Dummy type intg  in module COMPAV line 10 file average.f
  1266.         Actual type real  in module AVENUM line 43 file average.f
  1267.  
  1268.  
  1269.  
  1270.  
  1271.           According to Forchek, the  program  contains  variables
  1272.  
  1273.      which may be used before they are assigned an initial value,
  1274.  
  1275.      and variables which are not needed. Forchek also  warns  the
  1276.  
  1277.      user  that an integer quotient has been converted to a real.
  1278.  
  1279.      This may assist the user in catching an unintended  roundoff
  1280.  
  1281.      error.  Since the -symtab flag was given, Forchek prints out
  1282.  
  1283.      a table containing identifiers from  the  local  module  and
  1284.  
  1285.      their  corresponding  datatype  and  number  of  dimensions.
  1286.  
  1287.      Finally, Forchek warns that the function is  not  used  with
  1288.  
  1289.      the proper type of arguments.
  1290.  
  1291.  
  1292.           With Forchek's help, we can debug the program.  We  can
  1293.  
  1294.      see that there were the following errors:
  1295.  
  1296.      1.  SUM and COUNT should have been converted to real  before
  1297.          doing the division.
  1298.  
  1299.      2.  SUM should have been initialized to  0  before  entering
  1300.          the loop.
  1301.  
  1302.      3.  AVG was never printed out after being calculated.
  1303.  
  1304.      4.  NUMS should have been declared INTEGER instead of REAL.
  1305.  
  1306.  
  1307.      We also see that I, not J, should have been declared INTEGER
  1308.  
  1309.      in  function  COMPAV.  Also,  MAXNOS  was  not  declared  as
  1310.  
  1311.      INTEGER, and COMPAV as REAL, in program  AVENUM.  These  are
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321. FORCHEK                                                        Page 20
  1322.  
  1323.  
  1324.      not  errors,  but  they  may  indicate  carelessness.  As it
  1325.  
  1326.      happened, the default type of these variables coincided with
  1327.  
  1328.      the intended type.
  1329.  
  1330.  
  1331.           Here is the corrected program, and its output when run:
  1332.  
  1333.  
  1334.      C       AUTHORS: MIKE MYERS AND LUCIA SPAGNUOLO
  1335.      C       DATE:    MAY 8, 1989
  1336.      C
  1337.      C       Variables:
  1338.      C               SCORE -> an array of test scores
  1339.      C               SUM ->   sum of the test scores
  1340.      C               COUNT -> counter of scores read in
  1341.      C               I ->     loop counter
  1342.      C
  1343.             REAL FUNCTION COMPAV(SCORE,COUNT)
  1344.                  INTEGER SUM,COUNT,I,SCORE(5)
  1345.      C
  1346.                  SUM = 0
  1347.                  DO 30 I = 1,COUNT
  1348.                      SUM = SUM + SCORE(I)
  1349.      30          CONTINUE
  1350.                  COMPAV = FLOAT(SUM)/FLOAT(COUNT)
  1351.              END
  1352.      C
  1353.      C
  1354.              PROGRAM AVENUM
  1355.      C
  1356.      C                       MAIN PROGRAM
  1357.      C
  1358.      C       AUTHOR:   LOIS BIGBIE
  1359.      C       DATE:     MAY 15, 1990
  1360.      C
  1361.      C       Variables:
  1362.      C               MAXNOS -> maximum number of input values
  1363.      C               NUMS    -> an array of numbers
  1364.      C               COUNT   -> exact number of input values
  1365.      C               AVG     -> average returned by COMPAV
  1366.      C               I       -> loop counter
  1367.      C
  1368.      C
  1369.                  INTEGER MAXNOS
  1370.                  PARAMETER(MAXNOS=5)
  1371.                  INTEGER I, NUMS(MAXNOS), COUNT
  1372.                  REAL AVG,COMPAV
  1373.                  COUNT = 0
  1374.                  DO 80 I = 1,MAXNOS
  1375.                      READ (5,*,END=100) NUMS(I)
  1376.                      COUNT = COUNT + 1
  1377.      80          CONTINUE
  1378.      100         AVG = COMPAV(NUMS, COUNT)
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387. FORCHEK                                                        Page 21
  1388.  
  1389.  
  1390.                  WRITE(6,*) 'AVERAGE =',AVG
  1391.              END
  1392.  
  1393.      $ run average
  1394.      70
  1395.      90
  1396.      85
  1397.      <EOF>
  1398.      AVERAGE =   81.66666
  1399.      $
  1400.  
  1401.  
  1402.           With Forchek's help, our program is a success!
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453. FORCHEK                                                        Page 22
  1454.  
  1455.  
  1456.      5  INTERPRETING THE OUTPUT
  1457.  
  1458.  
  1459.  
  1460.  
  1461.           Forchek will print out four  main  types  of  messages.
  1462.  
  1463.      They are portability warnings, other warnings, informational
  1464.  
  1465.      messages, and syntax errors.  Portability  warnings  specify
  1466.  
  1467.      nonstandard  usages  that  may  not  be  accepted  by  other
  1468.  
  1469.      compilers. Other warning messages  report  potential  errors
  1470.  
  1471.      that  are  not normally flagged by a compiler. Informational
  1472.  
  1473.      messages consist of warnings which may assist  the  user  in
  1474.  
  1475.      the debugging of their Fortran program.
  1476.  
  1477.  
  1478.           Syntax errors are violations of the  Fortran  language.
  1479.  
  1480.      The  user  should have already eliminated these by using the
  1481.  
  1482.      Fortran compiler. Forchek does not detect all syntax errors.
  1483.  
  1484.      Generally,   Forchek  only  does  as  much  syntactic  error
  1485.  
  1486.      checking as is necessary in order for it to work properly.
  1487.  
  1488.  
  1489.           If Forchek gives you a syntax error  message  when  the
  1490.  
  1491.      compiler  does  not,  it  is  probably  because your program
  1492.  
  1493.      contains an extension to standard Fortran which is  accepted
  1494.  
  1495.      by the compiler but not by Forchek. On a VAX/VMS system, you
  1496.  
  1497.      can use the compiler option /STANDARD to cause the  compiler
  1498.  
  1499.      to  accept only standard Fortran. On most Unix systems, this
  1500.  
  1501.      can be accomplished by setting the flag -ansi.
  1502.  
  1503.  
  1504.           Most error messages are self-explanatory.  Those  which
  1505.  
  1506.      need  a brief explanation are listed below. Please note that
  1507.  
  1508.      any  error  messages  which  begin  with  'oops'  refer   to
  1509.  
  1510.      technical  conditions  and  indicate bugs in Forchek or that
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519. FORCHEK                                                        Page 23
  1520.  
  1521.  
  1522.      its resources have been exceeded.
  1523.  
  1524.  
  1525.      The following messages warn about portability or nonstandard
  1526.      usages:
  1527.  
  1528.  
  1529.        "Nonstandard format item"
  1530.  
  1531.            Forchek  will  flag  nonstandard  items  in  a  FORMAT
  1532.            statement  which  may  not  be  compatible  with other
  1533.            systems.
  1534.  
  1535.  
  1536.        "characters past 72 columns"
  1537.  
  1538.            A  statement  has  been  read   which   has   nonblank
  1539.            characters  past  column  72. Standard Fortran ignores
  1540.            all text in those columns, but many compilers do  not.
  1541.            Thus   the  program  may  be  treated  differently  by
  1542.            different compilers.
  1543.  
  1544.  
  1545.        "Warning: file contains tabs. May not be portable."
  1546.  
  1547.            Forchek expands tabs to be equivalent to spaces up  to
  1548.            the  next  column  which  is  a  multiple  of  8. Some
  1549.            compilers treat  tabs  differently,  and  also  it  is
  1550.            possible  that files sent by electronic mail will have
  1551.            the tabs converted to blanks in  some  way.  Therefore
  1552.            files  containing  tabs  may not be compiled correctly
  1553.            after being transferred. Forchek does  not  give  this
  1554.            message if tabs only occur within comments or strings.
  1555.  
  1556.  
  1557.        "nonstandard type usage in expression"
  1558.  
  1559.            The program contains an operation such  as  a  logical
  1560.            operation between integers, which is not standard, and
  1561.            may not be acceptable to some compilers.
  1562.  
  1563.  
  1564.        "Common  block  has  mixed  character  and   non-character
  1565.            variables"
  1566.  
  1567.        "Common block has long  data  type  following  short  data
  1568.            type"
  1569.  
  1570.            The ANSI standard requires that if any variable  in  a
  1571.            common  block  is  of  type  CHARACTER, then all other
  1572.            variables in the same common block  must  also  be  of
  1573.            type  CHARACTER.  Some  compilers additionally require
  1574.            that if a common block contains mixed data types,  all
  1575.            long  types (namely DOUBLE PRECISION and COMPLEX) must
  1576.            precede all short types (namely integer, real, etc.).
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585. FORCHEK                                                        Page 24
  1586.  
  1587.  
  1588.      The following messages are warning messages:
  1589.  
  1590.  
  1591.  
  1592.        "Integer quotient expr converted to real"
  1593.  
  1594.        "integer quotient expr used in exponent"
  1595.  
  1596.            The quotient of two integers  results  in  an  integer
  1597.            type  result, in which the fractional part is dropped.
  1598.            If such an integer expression  involving  division  is
  1599.            later  converted  to a real datatype, it may be that a
  1600.            real type division had been intended. Likewise, if  it
  1601.            is  used as an exponent, it is likely that a real type
  1602.            division was intended.
  1603.  
  1604.  
  1605.        "real truncated to intg"
  1606.  
  1607.            Forchek has detected an assignment statement which has
  1608.            a  real  expression  on  the  right,  but  an  integer
  1609.            variable on the left. The fractional part of the  real
  1610.            value will be lost. If you explicitly convert the real
  1611.            expression to integer using the INT or NINT  intrinsic
  1612.            function,  no  warning  will  be  printed.  A  similar
  1613.            message is printed if a double precision expression is
  1614.            assigned to a real variable, etc.
  1615.  
  1616.  
  1617.        "Continuation follows comment or blank line"
  1618.  
  1619.            Forchek issues this warning message to alert the  user
  1620.            that  a  continuation  of  a statement is interspersed
  1621.            with comments, making it easy to overlook.
  1622.  
  1623.  
  1624.        "Possible division by zero"
  1625.  
  1626.            This message is printed out wherever division is  done
  1627.            (except  division  by  a  constant),  if the -division
  1628.            option was selected.
  1629.  
  1630.  
  1631.        "NAME not set when RETURN encountered"
  1632.  
  1633.            The way that functions in Fortran return a value is by
  1634.            assigning  the value to the name of the function. This
  1635.            message indicates that the function was not assigned a
  1636.            value  before  the  point where a RETURN statement was
  1637.            found. Therefore it  is  possible  that  the  function
  1638.            could return an undefined value.
  1639.  
  1640.  
  1641.        "Unknown intrinsic function"
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651. FORCHEK                                                        Page 25
  1652.  
  1653.  
  1654.            This message warns the user that a name declared in an
  1655.            INTRINSIC statement is unknown to Forchek. Probably it
  1656.            is  a  nonstandard  intrinsic  function,  and  so  the
  1657.            program  will  not  be  portable. The function will be
  1658.            treated by Forchek as a user-defined function.
  1659.  
  1660.  
  1661.  
  1662.      The following messages are syntax errors:
  1663.  
  1664.  
  1665.  
  1666.        "syntax error"
  1667.  
  1668.            The parser, which analyzes the  Fortran  program  into
  1669.            expressions, statements, etc., has been unable to find
  1670.            a valid interpretation for some portion of a statement
  1671.            in  the  program.  If  the  compiler does not report a
  1672.            syntax error  at  the  same  place,  the  most  common
  1673.            explanations  are:  (1)  use  of a reserved word as an
  1674.            array or  character  variable  (see  Table  2  in  the
  1675.            section entitled "Limitations and Extensions"), or (2)
  1676.            use of an extension to ANSI standard Fortran  that  is
  1677.            not recognized by Forchek.
  1678.  
  1679.  
  1680.        "No path to this statement"
  1681.  
  1682.            Forchek will detect statements which  are  ignored  or
  1683.            by-passed because there is no foreseeable route to the
  1684.            statement. For example,  an  unnumbered  statement  (a
  1685.            statement   without   a  statement  label),  occurring
  1686.            immediately after a GOTO statement, cannot possibly be
  1687.            executed.
  1688.  
  1689.  
  1690.        "Statement out of order."
  1691.  
  1692.            Forchek will detect statements that  are  out  of  the
  1693.            sequence specified for ANSI standard Fortran-77. Table
  1694.            1 illustrates the allowed sequence  of  statements  in
  1695.            the  Fortran  language.  Statements  which  are out of
  1696.            order  are  nonetheless  interpreted  by  Forchek,  to
  1697.            prevent "cascades" of error messages.
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717. FORCHEK                                                        Page 26
  1718.  
  1719.  
  1720.           --------------------------------------------------------
  1721.                             |               | implicit
  1722.                             |  parameter    |---------------------
  1723.                             |               | other specification
  1724.                   format    |---------------|---------------------
  1725.                    and      |               | statement-function
  1726.                   entry     |  data         |---------------------
  1727.                             |               | executable
  1728.           --------------------------------------------------------
  1729.  
  1730.                                 Table 1
  1731.  
  1732.  
  1733.      The following messages are informational messages:
  1734.  
  1735.  
  1736.  
  1737.        "Declared but never referenced"
  1738.  
  1739.            Detects any identifiers that  were  declared  in  your
  1740.            program  but  were never used, either to be assigned a
  1741.            value or to have their value  accessed.  Variables  in
  1742.            common are excluded.
  1743.  
  1744.  
  1745.        "Variables used before set"
  1746.  
  1747.            This message indicates that an identifier is  used  to
  1748.            compute  a  value  prior  to  its initialization. Such
  1749.            usage may lead to an incorrect value being computed.
  1750.  
  1751.  
  1752.        "Variables may be used before set"
  1753.  
  1754.            Similar to used before set except that Forchek is  not
  1755.            able  to  determine its status with certainty. Forchek
  1756.            assumes a variable may be used before set if the first
  1757.            usage of the variable occurs prior in the program text
  1758.            to its assignment.
  1759.  
  1760.  
  1761.        "Variables set but never used"
  1762.  
  1763.            Forchek will notify the user when a variable has  been
  1764.            assigned  a  value,  but the variable is not otherwise
  1765.            used in the program.  Usually  this  results  from  an
  1766.            oversight.
  1767.  
  1768.  
  1769.        "Type has been implicitly defined"
  1770.  
  1771.            Forchek  will  flag  all  identifiers  that  are   not
  1772.            explicitly  typed  and will show the datatype that was
  1773.            assigned  through  implicit  typing.   This   provides
  1774.            support for users who wish to declare all variables as
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783. FORCHEK                                                        Page 27
  1784.  
  1785.  
  1786.            is required in Pascal or some  other  languages.  This
  1787.            message  is printed only when the -symtab option is in
  1788.            effect.
  1789.  
  1790.  
  1791.        "Identifiers which are not unique in first six chars"
  1792.  
  1793.            Warns that two identifiers which  are  longer  than  6
  1794.            characters  do  not differ in first 6 characters. This
  1795.            is  for  portability:  they  may  not  be   considered
  1796.            distinct  by  some  compilers. This message is printed
  1797.            only if the -sixchar option was selected.
  1798.  
  1799.  
  1800.        "Subprogram NAME: varying length argument lists:"
  1801.  
  1802.            An inconsistency has been found between the number  of
  1803.            dummy  arguments (parameters) a subprogram has and the
  1804.            number of actual arguments given it in an  invocation.
  1805.            Forchek  keeps track of all invocations of subprograms
  1806.            (CALL statements and expressions using functions)  and
  1807.            compares  them with the definitions of the subprograms
  1808.            elsewhere in the source  code.  The  Fortran  compiler
  1809.            normally does not catch this type of error.
  1810.  
  1811.  
  1812.     "Subprogram NAME: argument data type mismatch at position n"
  1813.  
  1814.            The subprogram's nth actual argument (in the  CALL  or
  1815.            the  usage of a function) differs in datatype from the
  1816.            nth dummy argument  (in  the  SUBROUTINE  or  FUNCTION
  1817.            declaration).  For  instance,  if  the  user defines a
  1818.            subprogram by
  1819.  
  1820.                 SUBROUTINE SUBA(X)
  1821.                 REAL X
  1822.  
  1823.            and elsewhere invokes SUBA by
  1824.  
  1825.                 CALL SUBA(2)
  1826.  
  1827.            Forchek will detect the error. The reason here is that
  1828.            the  number  2  is  integer, not real. The user should
  1829.            have said
  1830.  
  1831.                 CALL SUBA(2.0)
  1832.  
  1833.  
  1834.            When checking  an  argument  which  is  a  subprogram,
  1835.            Forchek  must  be  able  to  determine whether it is a
  1836.            function or a subroutine. The rules used by Forchek to
  1837.            do  this  are  as  follows: If the subprogram, besides
  1838.            being passed as an actual argument,  is  also  invoked
  1839.            directly  elsewhere  in the same module, then its type
  1840.            is determined by that usage. If not, then if the  name
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849. FORCHEK                                                        Page 28
  1850.  
  1851.  
  1852.            of  the subprogram does not appear in an explicit type
  1853.            declaration, it is assumed to be a subroutine;  if  it
  1854.            is  explicitly  typed  it  is  taken  as  a  function.
  1855.            Therefore, subroutines passed as actual arguments need
  1856.            only  be  declared  by  an  EXTERNAL  statement in the
  1857.            calling  module,  whereas  functions  must   also   be
  1858.            explicitly  typed  in  order  to avoid generating this
  1859.            error message.
  1860.  
  1861.  
  1862.        "Subprogram invoked inconsistently"
  1863.  
  1864.            Here the mismatch  is  between  the  datatype  of  the
  1865.            subprogram   itself   as  used  and  as  defined.  For
  1866.            instance, if the user declares
  1867.  
  1868.                 INTEGER FUNCTION COUNT(A)
  1869.  
  1870.            and invokes COUNT in another module as
  1871.  
  1872.                 N = COUNT(A)
  1873.  
  1874.            without declaring its datatype,  it  will  default  to
  1875.            real  type, based on the first letter of its name. The
  1876.            calling module should have included the declaration
  1877.  
  1878.                 INTEGER COUNT
  1879.  
  1880.  
  1881.        "possibly it is an array which was not declared"
  1882.  
  1883.            This message refers to a function invocation or to  an
  1884.            argument  type  mismatch,  for  which  the possibility
  1885.            exists that what appears to be a function is  actually
  1886.            meant  to  be  an  array.  If the programmer forgot to
  1887.            dimension an array, references to the  array  will  be
  1888.            interpreted as function invocations. This message will
  1889.            be suppressed if the name in question  appears  in  an
  1890.            EXTERNAL or INTRINSIC statement.
  1891.  
  1892.  
  1893.        "Subprogram NAME: argument usage mismatch"
  1894.  
  1895.            Forchek detects a possible conflict between the way  a
  1896.            subprogram  uses  an argument and the way in which the
  1897.            argument is supplied to the subprogram.  The  conflict
  1898.            can be one of two types, as outlined below.
  1899.  
  1900.  
  1901.        "Dummy arg is modified, Actual arg is const or expr"
  1902.  
  1903.            A  dummy  argument  is  an  argument  as  named  in  a
  1904.            SUBROUTINE  or  FUNCTION statement and used within the
  1905.            subprogram. An  actual  argument  is  an  argument  as
  1906.            passed  to  a  subroutine  or  function by the caller.
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915. FORCHEK                                                        Page 29
  1916.  
  1917.  
  1918.            Forchek is saying that a dummy argument is modified by
  1919.            the  subprogram, i.e. its value will be changed in the
  1920.            calling  module.  The  corresponding  actual  argument
  1921.            should  not  be a constant or expression, but rather a
  1922.            variable or array element which  can  be  legitimately
  1923.            assigned to.
  1924.  
  1925.  
  1926.        "Dummy arg used before set, Actual arg not set"
  1927.  
  1928.            Here a dummy argument may be used  in  the  subprogram
  1929.            before   having   a   value  assigned  to  it  by  the
  1930.            subprogram. The corresponding actual  argument  should
  1931.            have  a  value  assigned  to it by the caller prior to
  1932.            invoking the subprogram.
  1933.  
  1934.  
  1935.        "Common block NAME: varying length"
  1936.  
  1937.            A common block declared in different  subprograms  has
  1938.            different  numbers  of  variables  in  it in different
  1939.            declarations. This is not necessarily an error, but it
  1940.            may indicate that a variable is missing from the list.
  1941.  
  1942.  
  1943.        "Common block NAME: data type mismatch at position n"
  1944.  
  1945.            The nth variable in the common block differs  in  data
  1946.            type  in  two  different  declarations  of  the common
  1947.            block. By default (common strictness level 3), Forchek
  1948.            is  very  picky  about  common  blocks:  the variables
  1949.            listed in them must match exactly  by  data  type  and
  1950.            array   dimensions.   That   is,  the  legal  pair  of
  1951.            declarations in different modules:
  1952.  
  1953.                 COMMON /COM1/ A,B
  1954.  
  1955.            and
  1956.  
  1957.                 COMMON /COM1/ A(2)
  1958.  
  1959.            will cause Forchek  to  give  warnings  at  strictness
  1960.            level  3.  These two declarations are legal in Fortran
  1961.            since  they  both  declare  two  real  variables.   At
  1962.            strictness  level 1 or 2, no warning would be given in
  1963.            this example.
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981. FORCHEK                                                        Page 30
  1982.  
  1983.  
  1984.      6  LIMITATIONS AND EXTENSIONS
  1985.  
  1986.  
  1987.  
  1988.  
  1989.           Forchek accepts ANSI standard Fortran-77 programs  with
  1990.  
  1991.      the following exceptions:
  1992.  
  1993.  
  1994.  
  1995.      Restrictions:
  1996.  
  1997.  
  1998.           Forchek is sensitive to blank spaces.  This  encourages
  1999.  
  2000.           the  user  to use good programming style. The rules are
  2001.  
  2002.           similar to Pascal or C where a blank space is  required
  2003.  
  2004.           between  identifiers or keywords and not allowed inside
  2005.  
  2006.           identifiers or keywords. The following  keywords  which
  2007.  
  2008.           occur  in  pairs  may  be  written as either one or two
  2009.  
  2010.           words: DO WHILE or DOWHILE, ELSE IF or ELSEIF,  END  DO
  2011.  
  2012.           or ENDDO, END IF or ENDIF, GO TO or GOTO. Unlike Pascal
  2013.  
  2014.           and C, Forchek allows blanks inside numeric  constants,
  2015.  
  2016.           except  within  the  exponent  part  of  E  and  D form
  2017.  
  2018.           numbers. Also, if the -nolinebreak option is  selected,
  2019.  
  2020.           the end of line in continued statements is ignored.
  2021.  
  2022.  
  2023.           Complex constants are subject to a special restriction:
  2024.  
  2025.           they   may   not   be   split  across  lines,  even  in
  2026.  
  2027.           -nolinebreak mode.
  2028.  
  2029.  
  2030.           The dummy arguments in statement functions are  treated
  2031.  
  2032.           like  ordinary variables of the program. That is, their
  2033.  
  2034.           scope is the entire  module,  not  just  the  statement
  2035.  
  2036.           function definition.
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047. FORCHEK                                                        Page 31
  2048.  
  2049.  
  2050.           Some keywords and identifiers are  partially  reserved.
  2051.  
  2052.           See Table 2 for details.
  2053.  
  2054.  
  2055.  
  2056.  
  2057.      The following keywords may be freely used as variables:
  2058.  
  2059.      ASSIGN          BLOCK           CALL            CHARACTER
  2060.      COMMON          COMPLEX         CONTINUE        DIMENSION
  2061.      DO              DOUBLE          ELSE            END
  2062.      ENDDO           ENDIF           ENTRY           EXTERNAL
  2063.      FUNCTION        GO              IMPLICIT        INCLUDE
  2064.      INTEGER         INTRINSIC       LOGICAL         PAUSE
  2065.      PRECISION       PROGRAM         REAL            SAVE
  2066.      STOP            SUBROUTINE      THEN            TO
  2067.  
  2068.      The following keywords may be used in scalar contexts  only,
  2069.      for example, not as arrays or as character variables used in
  2070.      substring expressions.
  2071.  
  2072.      ACCEPT          BACKSPACE       CLOSE           DATA
  2073.      DOWHILE         ELSEIF          ENDFILE         EQUIVALENCE
  2074.      FORMAT          GOTO            IF              INQUIRE
  2075.      OPEN            PARAMETER       PRINT           READ
  2076.      RETURN          REWIND          TYPE            WRITE
  2077.      WHILE
  2078.  
  2079.                            Table 2
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.      Extensions:
  2088.  
  2089.  
  2090.           Tabs are  permitted,  and  translated  into  equivalent
  2091.  
  2092.           blanks  which  correspond to tab stops every 8 columns.
  2093.  
  2094.           The standard does not recognize tabs.  Note  that  some
  2095.  
  2096.           compilers allow tabs, but treat them differently.
  2097.  
  2098.  
  2099.           Lower case characters are permitted, and are  converted
  2100.  
  2101.           internally to uppercase except in strings. The standard
  2102.  
  2103.           specifies upper  case  only,  except  in  comments  and
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113. FORCHEK                                                        Page 32
  2114.  
  2115.  
  2116.           strings.
  2117.  
  2118.  
  2119.           Hollerith constants are permitted, in  accordance  with
  2120.  
  2121.           the ANSI Manual, appendix C. They should not be used in
  2122.  
  2123.           expressions, or confused with datatype CHARACTER.
  2124.  
  2125.  
  2126.           Statements may be longer than 72 columns provided  that
  2127.  
  2128.           the  setting  "-column" was used to increase the limit.
  2129.  
  2130.           According to the standard, all  text  from  columns  73
  2131.  
  2132.           through  80  is ignored, and no line may be longer than
  2133.  
  2134.           80 columns.
  2135.  
  2136.  
  2137.           Variable names may be longer than six  characters.  The
  2138.  
  2139.           standard specifies six as the maximum.
  2140.  
  2141.  
  2142.           Variable  names  may  contain  underscores,  which  are
  2143.  
  2144.           treated the same as alphabetic letters. The VAX version
  2145.  
  2146.           of Forchek also allows dollar signs in variable  names,
  2147.  
  2148.           but not as the initial character.
  2149.  
  2150.  
  2151.           The DO ... ENDDO control structure  is  permitted.  The
  2152.  
  2153.           syntax  which  is  recognized is according to either of
  2154.  
  2155.           the following two forms:
  2156.  
  2157.                    DO [label [,]] var = expr , expr [, expr]
  2158.                      ...
  2159.                    END DO
  2160.           or
  2161.                    DO [label [,]] WHILE ( expr )
  2162.                      ...
  2163.                    END DO
  2164.  
  2165.  
  2166.           where square brackets indicate optional elements.
  2167.  
  2168.  
  2169.           The ACCEPT and TYPE statements are permitted, with  the
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179. FORCHEK                                                        Page 33
  2180.  
  2181.  
  2182.           same syntax as PRINT.
  2183.  
  2184.  
  2185.           Statements may have any number of  continuation  lines.
  2186.  
  2187.           The standard allows a maximum of 19.
  2188.  
  2189.  
  2190.           Inline comments, beginning with  an  exclamation  mark,
  2191.  
  2192.           are permitted.
  2193.  
  2194.  
  2195.           The IMPLICIT NONE statement is supported.  The  meaning
  2196.  
  2197.           of this statement is that all variables must have their
  2198.  
  2199.           data types explicitly declared. Rather  than  flag  the
  2200.  
  2201.           occurrences   of   such  variables  with  syntax  error
  2202.  
  2203.           messages, Forchek waits till the end of the module, and
  2204.  
  2205.           then prints out a list of all undeclared variables.
  2206.  
  2207.  
  2208.           Data types INTEGER,  REAL,  COMPLEX,  and  LOGICAL  are
  2209.  
  2210.           allowed  to  have  an  optional length specification in
  2211.  
  2212.           type declarations. For instance, REAL*8 means an 8-byte
  2213.  
  2214.           floating  point  data  type.  The  REAL*8  datatype  is
  2215.  
  2216.           interpreted  by  Forchek  as   equivalent   to   DOUBLE
  2217.  
  2218.           PRECISION. Forchek ignores length specifications on all
  2219.  
  2220.           other types. The standard allows a length specification
  2221.  
  2222.           only for CHARACTER data.
  2223.  
  2224.  
  2225.           Forchek permits the  INCLUDE  statement,  which  causes
  2226.  
  2227.           inclusion of the text of the given file. The syntax is
  2228.  
  2229.                    INCLUDE 'filename'
  2230.  
  2231.           When compiled for VMS, Forchek will  assume  a  default
  2232.  
  2233.           extension  of  .for  if no filename extension is given.
  2234.  
  2235.           Also for compatibility with VMS, the VMS version allows
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245. FORCHEK                                                        Page 34
  2246.  
  2247.  
  2248.           the  qualifier  /[NO]LIST  following  the  filename, to
  2249.  
  2250.           control the listing of the included file. There  is  no
  2251.  
  2252.           support for including VMS text modules.
  2253.  
  2254.  
  2255.           At this  time,  diagnostic  output  relating  to  items
  2256.  
  2257.           contained in include files is minimal. Only information
  2258.  
  2259.           about the location in the include file is given.  There
  2260.  
  2261.           is  no  traceback  giving  the parent file(s), although
  2262.  
  2263.           usually this can be inferred from the context.
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311. FORCHEK                                                        Page 35
  2312.  
  2313.  
  2314.      7  NEW FEATURES
  2315.  
  2316.  
  2317.  
  2318.  
  2319.           Here are the changes from Version 2.3 to Version 2.4:
  2320.  
  2321.      1.  Fixed bugs: the SAVE statement was incorrectly parsed, a
  2322.          CALL  of  a  user  function  with  the  same  name as an
  2323.          intrinsic function assumed by default to  refer  to  the
  2324.          intrinsic function, and adjustable-size arrays passed as
  2325.          arguments were not correctly checked. Also, the usage of
  2326.          variables   in  some  I/O  control-list  specifiers  was
  2327.          handled incorrectly.
  2328.  
  2329.      2.  New  options  "-declare,"   "-f77,"   "-linebreak"   and
  2330.          "-verbose."
  2331.  
  2332.      3.  Allow embedded space in numeric constants.
  2333.  
  2334.      4.  Support ACCEPT, IMPLICIT NONE and INCLUDE statements.
  2335.  
  2336.      5.  Analyze EQUIVALENCE statements.
  2337.  
  2338.      6.  Common block checking levels 1 and 2.
  2339.  
  2340.      7.  IMPORTANT: the project-file  format  has  been  changed.
  2341.          Project  files created by Version 2.3 are not compatible
  2342.          with Version 2.4, and will need to be remade.
  2343.  
  2344.  
  2345.  
  2346.           Here are the changes from Version 2.2 to Version 2.3:
  2347.  
  2348.      1.  Three bugs were fixed: Version 2.2  crashed  if  a  real
  2349.          constant  exceeding the magnitude limit was encountered;
  2350.          the computation of hash codes was not portable to 64-bit
  2351.          machines;  and  spurious  used-before-set  messages were
  2352.          generated by statement functions. We thank Greg Flint of
  2353.          Purdue University and Warren J. Wiscombe of NASA Goddard
  2354.          for pointing some of these out.
  2355.  
  2356.      2.  Allow complex constants in expressions.
  2357.  
  2358.      3.  Allow DO ... ENDDO structure
  2359.  
  2360.      4.  Allow TYPE statement.
  2361.  
  2362.      5.  Allow underscores in variable names.
  2363.  
  2364.      6.  Allow inline comments.
  2365.  
  2366.      7.  Provide project-file capability.
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377. FORCHEK                                                        Page 36
  2378.  
  2379.  
  2380.      8.  Suppress used-before-set messages for  implied-do  index
  2381.          (see Bugs section).
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443. FORCHEK                                                        Page 37
  2444.  
  2445.  
  2446.      8  BUGS
  2447.  
  2448.  
  2449.  
  2450.  
  2451.           Forchek still  has  much  room  for  improvement.  Your
  2452.  
  2453.      feedback  is appreciated. We want to know about any bugs you
  2454.  
  2455.      notice. Bugs include not only cases in which Forchek  issues
  2456.  
  2457.      an  error message where no error exists, but also if Forchek
  2458.  
  2459.      fails to issue a warning when it ought  to.  Note,  however,
  2460.  
  2461.      that  Forchek  is  not  intended to catch all syntax errors.
  2462.  
  2463.      Also, it is not considered  a  bug  for  a  variable  to  be
  2464.  
  2465.      reported as used before set, if the reason is that the usage
  2466.  
  2467.      of the variable occurs  prior  in  the  text  to  where  the
  2468.  
  2469.      variable  is set. For instance, this could occur when a GOTO
  2470.  
  2471.      causes execution to loop backward to some previously skipped
  2472.  
  2473.      statements.  Forchek  does not analyze the program flow, but
  2474.  
  2475.      assumes that statements occurring earlier in  the  text  are
  2476.  
  2477.      executed before the following ones.
  2478.  
  2479.  
  2480.           We especially want to know if Forchek crashes  for  any
  2481.  
  2482.      reason.  It  is not supposed to crash, even on programs with
  2483.  
  2484.      syntax  errors.  Suggestions  are  welcomed  for  additional
  2485.  
  2486.      features  which  you  would  find  useful. Tell us if any of
  2487.  
  2488.      Forchek's messages are  incomprehensible.  Comments  on  the
  2489.  
  2490.      readability and accuracy of this document are also welcome.
  2491.  
  2492.  
  2493.           You may also suggest support for additional  extensions
  2494.  
  2495.      to  the  Fortran language. These will be included only if it
  2496.  
  2497.      is felt that the extensions are sufficiently widely accepted
  2498.  
  2499.      by compilers.
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509. FORCHEK                                                        Page 38
  2510.  
  2511.  
  2512.           If you find a bug in Forchek, first consult the list of
  2513.  
  2514.      known  bugs  below  to  see if it has already been reported.
  2515.  
  2516.      Also check the section entitled "Limitations and Extensions"
  2517.  
  2518.      above for restrictions that could be causing the problem. If
  2519.  
  2520.      you do not find the problem documented in either place, then
  2521.  
  2522.      send a report including
  2523.  
  2524.           1.  The operating system and CPU type on which  Forchek
  2525.               is running.
  2526.  
  2527.           2.  The version of Forchek.
  2528.  
  2529.           3.  A brief description of the bug.
  2530.  
  2531.           4.  If possible, a small  sample  program  showing  the
  2532.               bug.
  2533.  
  2534.  
  2535.      The report  should  be  sent  to  either  of  the  following
  2536.  
  2537.      addresses:
  2538.  
  2539.              MONIOT@FORDMULC.BITNET
  2540.  
  2541.              moniot@mary.fordham.edu
  2542.  
  2543.      Highest priority will be given to bugs which  cause  Forchek
  2544.  
  2545.      to   crash.  Bugs  involving  incorrect  warnings  or  error
  2546.  
  2547.      messages may take longer to fix.
  2548.  
  2549.  
  2550.           The following is a list of known bugs.
  2551.  
  2552.      1.  Bug: Functions which modify their  arguments  may  cause
  2553.          used-before-set warning. For example, A in the statement
  2554.                  X = FUN(A)
  2555.          if A is not previously set. If FUN has  the  purpose  of
  2556.          setting  A, this situation will not be a bug. Generally,
  2557.          however, it is not considered good style  for  functions
  2558.          to  modify their arguments, and so the warning may be to
  2559.          good purpose.
  2560.  
  2561.          Prognosis: Probably will not be fixed anytime soon.
  2562.  
  2563.      2.  Bug:  Used-before-set  message  is  suppressed  for  any
  2564.          variable   which  is  used  as  the  loop  index  in  an
  2565.          implied-do loop, even if it  was  in  fact  used  before
  2566.          being  set  in  some  earlier  statement.  For  example,
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575. FORCHEK                                                        Page 39
  2576.  
  2577.  
  2578.          consider J in the statement
  2579.                  WRITE(5,*) (A(J), J=1,10)
  2580.          Here Forchek parses the I/O expression, A(J), where J is
  2581.          used,  before it parses the implied loop where J is set.
  2582.          Normally this would cause Forchek to report  a  spurious
  2583.          used-before-set  warning  for  J.  Since  this report is
  2584.          usually in error and  occurs  fairly  commonly,  Forchek
  2585.          suppresses the warning for J altogether.
  2586.  
  2587.          Prognosis: A future version of Forchek is planned  which
  2588.          will handle implied-do loops correctly.
  2589.  
  2590.      3.  Bug:   Variables   used   (not    as    arguments)    in
  2591.          statement-function  subprograms  do not have their usage
  2592.          status updated when the statement function is invoked.
  2593.  
  2594.          Prognosis: To be fixed in a future version of Forchek.
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641. FORCHEK                                                        Page 40
  2642.  
  2643.  
  2644.      9  CONCLUSION
  2645.  
  2646.  
  2647.  
  2648.  
  2649.           Forchek was designed by Dr. Robert Moniot, professor at
  2650.  
  2651.      Fordham  University,  College  at Lincoln Center. During the
  2652.  
  2653.      academic  year  of  1988-1989,  Michael  Myers   and   Lucia
  2654.  
  2655.      Spagnuolo  developed  the  program  to  perform the variable
  2656.  
  2657.      usage checks. During the following year it was augmented  by
  2658.  
  2659.      Lois  Bigbie  to check subprogram arguments and common block
  2660.  
  2661.      declarations. Brian Downing assisted with the implementation
  2662.  
  2663.      of  the INCLUDE statement. Additional features will be added
  2664.  
  2665.      as time permits.
  2666.  
  2667.  
  2668.           We would like to thank Markus Draxler of the University
  2669.  
  2670.      of  Stuttgart,  Greg Flint of Purdue University, Phil Sterne
  2671.  
  2672.      of Lawrence Livermore National  Laboratory,  and  Warren  J.
  2673.  
  2674.      Wiscombe of NASA Goddard for reporting some bugs in Versions
  2675.  
  2676.      2.1 and 2.2. We also thank John Amor of  the  University  of
  2677.  
  2678.      British  Columbia,  Daniel P. Giesy of NASA Langley Research
  2679.  
  2680.      Center,  Hugh  Nicholas  of  the  Pittsburgh  Supercomputing
  2681.  
  2682.      Center, Dan Severance of Yale University, and Larry Weissman
  2683.  
  2684.      of  the  University  of  Washington  for   suggesting   some
  2685.  
  2686.      improvements.  Nelson  H. F. Beebe of the University of Utah
  2687.  
  2688.      kindly  helped  with  the  documentation,  and  pointed  out
  2689.  
  2690.      several  bugs  in  Version 2.3. Reg Clemens of the Air Force
  2691.  
  2692.      Phillips Lab in Albuquerque and Fritz Keinert of Iowa  State
  2693.  
  2694.      University  helped  debug  Version  2.4.  We also thank Jack
  2695.  
  2696.      Dongarra for putting Forchek  into  the  Netlib  library  of
  2697.  
  2698.      publicly available software.
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707. FORCHEK                                                        Page 41
  2708.  
  2709.  
  2710.           For further information, you  may  contact  Dr.  Robert
  2711.  
  2712.      Moniot at either of the following network addresses:
  2713.  
  2714.              MONIOT@FORDMULC.BITNET
  2715.  
  2716.              moniot@mary.fordham.edu
  2717.  
  2718.  
  2719.      This document is named FORCHEK.DOC. The Forchek program  can
  2720.  
  2721.      be obtained by sending the message
  2722.  
  2723.  
  2724.          send forchek from fortran
  2725.  
  2726.  
  2727.      to the  Internet  address:  netlib@ornl.gov  .  Installation
  2728.  
  2729.      requires a C compiler for your computer.
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.